package com.fms.controller;

import com.fms.entity.WarehouseHardware;
import com.fms.dto.OutboundAddQuery;
import com.fms.result.ResultData;
import com.fms.service.OutboundOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/outbound")
@RequiredArgsConstructor
public class OutboundController {
    private final OutboundOrderService outboundOrderService;

    //新增出库单
    @PostMapping("/addOutbound")
    public ResultData addOutbound(@RequestBody OutboundAddQuery outboundAddQuery){
        System.out.println(outboundAddQuery);
        ResultData resultData =  outboundOrderService.addOutbound(outboundAddQuery);

        return resultData;
    }

    //删除出库单材料
    @PostMapping("/deleteHardware")
    public ResultData deleteHardware(@RequestBody WarehouseHardware warehouseHardware){
        System.out.println(warehouseHardware);
        return ResultData.success();
    }

    //获取已填写出库单板子
    @GetMapping("/getOutboundBoard/{orderId}")
    public ResultData getOutboundBoard(@PathVariable("orderId") Long orderId){
        return ResultData.success();
    }

    //获取所有出货单信息
    @GetMapping("/getOutbounds")
    public ResultData getOutbounds(){
        ResultData resultData = outboundOrderService.getOutbounds();
        return resultData;
    }
}
